<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>Traffic Simulator Compilation Instructions</title>
		
		<style type="text/css">
			h2, h3 { margin-top: 2em; }
			li { margin: 1em 0; }
			strong.filedir
			{
				font-style: normal;
				font-family: monospace;
			}
			code
			{
				display: block;
				margin: 1em;
				padding: 1em;
				background-color: #ccc;
				width: auto;
			}
		</style>
	</head>
	
	<body>
		
		<h1>
			Compilation Instructions for Traffic Simulator (C++ Version)<br>
			For Windows XP with <a href="http://www.mingw.org/">MinGW and MSYS</a>
		</h1>
		
		<h2>Required Libraries</h2>
		<p><em>The application uses string-conversion and type-conversion functions from Adam Rehn's Base Library for C++. The relevant header file is included with the project's source files; <strong>there is no need to install this library.</strong></em></p>
		<p>The application relies on three popular open-source libraries:</p>
		<ul>
			<li>
				<h3><a href="http://www.libsdl.org/">SDL</a></h3>
				Download the latest stable version (<a href="http://www.libsdl.org/release/SDL-devel-1.2.14-mingw32.tar.gz">1.2.14 was used for development</a>) and extract the files. Copy the files from the <strong class="filedir">include</strong> and <strong class="filedir">lib</strong> directories to the corresponding directories in the MinGW folder.
			</li>
				
			<li>
				<h3><a href="http://www.sqlite.org/">SQLite</a></h3>
				Download the latest stable version (<a href="http://www.sqlite.org/sqlite-amalgamation-3_6_11.zip">3.6.11 was used for development</a>) and extract the files. You can compile the static library like so:
				<code>
					$ <strong class="filedir">gcc</strong> -c sqlite3.c -o sqlite3.o<br>
					$ <strong class="filedir">ar</strong> rcs libsqlite3.a sqlite3.o
				</code>
				Copy the file <strong class="filedir">libsqlite3.a</strong> to the MinGW <strong class="filedir">lib</strong> folder, and the file <strong class="filedir">sqlite3.h</strong> to the MinGW <strong class="filedir">include</strong> folder.
			</li>
			
			<li>
				<h3><a href="http://www.wxwidgets.org/">wxWidgets</a></h3>
				Download the latest stable version (<a href="http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.11-Setup.exe">2.8.11 was used for development</a>) and run the installer. You can compile the library <strong>using MSYS</strong> in the wxWidgets directory like so:
				<code>
					$ <strong class="filedir">./configure</strong> --enable-monolithic<br>
					$ <strong class="filedir">make</strong>
				</code>
				Both of these steps may take a fairly long time each, so it may be easier to enter both of them as one semicolon-delimited command and leave it running. Afterwards, you will need to copy the following files:
				<ul>
					<li>All of the <strong class="filedir">.a</strong> files from the <strong class="filedir">lib</strong> directory to the corresponding MinGW <strong class="filedir">lib</strong> directory,</li>
					<li>The directory <strong class="filedir">include/wx</strong> to MinGW as <strong class="filedir">include/wx</strong>,</li>
					<li>Finally, you will need to copy the file <strong class="filedir">include/msvc/wx/setup.h</strong> to MinGW as <strong class="filedir">include/wx/setup.h</strong></li>
				</ul>
			</li>
		</ul>
		
		<h2>Compiling the application</h2>
		
		<h3>Optional Pre-Compilation Step: XP Styles Manifest</h3>
		<p><em>This step results in a purely aesthetic change to the application's GUI and does not affect any functionality.</em></p>
		<p>To enable the latest version of the Windows Common Controls simply run the batch script <strong class="filedir">source/cpp/win32_resources/compile_resources.bat</strong>.</p>
		<p>This will create an object file that, when linking is performed, will embed a manifest file in the application that instructs Windows to use the latest version of the common controls.</p>
		
		<h3>How to compile</h3>
		<p>
			Assuming that you have downloaded the correct versions of the libraries and installed them as detailed in the <em>"Required Libraries"</em> section above, you should be able to compile the application from the <strong class="filedir">source/cpp</strong> directory simply like so:
			<code>$ <strong class="filedir">make</strong></code>
		</p>
		<p>If everything compiles correctly, the executable should be created as <strong class="filedir">source/cpp/build/TrafficSimulator.exe</strong>.</p>
		<p>You will need to copy the files <strong class="filedir">SDL.dll</strong> and <strong class="filedir">wxmsw28_gcc_custom.dll</strong> (obtained earlier when installing the libraries) into the <strong class="filedir">build</strong> directory. You will then finally be able to run the application!</p>
		<p><em>Note that to run the executable file on computers without MinGW installed, you will also need the file <strong class="filedir">mingwm10.dll</strong> from the MinGW <strong class="filedir">bin</strong> directory.</em></p>
		
	</body>
</html>